//
//  STDParam.h
//  STDRenderSDK
//
//  Created by 陈学明 on 2023/3/15.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
/// 混合模式
typedef enum : NSUInteger {
    STDSBlendTypeNormal = 1, // 正常
    STDSBlendTypeMultioly, // 相乘
    STDSBlendTypeScreen, // 屏幕
    STDSBlendTypeOverlay, // 叠加
    STDSBlendTypeDarken, // 变暗
    STDSBlendTypeLighten, // 变亮
    STDSBlendTypeColorDodge, // 颜色减淡
    STDSBlendTypeColorBurn, // 颜色加深
    STDSBlendTypeHardLight, // 强光
    STDSBlendTypeSoftLight, // 柔光
    STDSBlendTypeDiffrence, // 差值
    STDSBlendTypeExclusion, // 排除
    STDSBlendTypeAdd, // 相加
} STDSBlendType;

/// 图层类型
typedef enum : NSUInteger {
    STDSLayerTypeImage = 1, // 图片图层
    STDSLayerTypeVideo, // 视频图层
    STDSLayerTypeText, // 文本层
    STDSLayerTypeShapen, // 形状图层
    STDSLayerTypeEmpty, // 空图层
    STDSLayerTypeCompose, // 预合成层
    STDSLayerTypeSolidColor, // 纯色层
    STDSLayerTypeCamora, // 摄像机层
} STDSLayerType;

/// 效果类型
typedef enum : NSUInteger {
    STDSEffectTypeDefault = 1, // 默认效果
    STDSEffectTypeTransformation = 2, // 基础变换
    STDSEffectTypeHotShader = 3, // 热加载效果
    STDSEffectTypeGraphic = 4, // 热加载效果，图结构
    STDSEffectTypeBlend = 5, // 混合模式
    STDSEffectTypeGrain = 6,
    STDSEffectTypeGaussianBlur = 7,
    STDSEffectTypeHairColor = 8,
    STDSEffectTypeContrast = 9,
    STDSEffectTypeGlowLight = 10,
    STDSEffectTypeVignette = 11,
    STDSEffectTypeColorGrain = 12,
    STDSEffectTypeLightArea = 13,
    STDSEffectTypeWhiteBalance = 14,
    STDSEffectTypeMixMask = 15,
    STDSEffectTypeSkinDetect = 16,
    STDSEffectTypeSkinLutDetect = 17,
    STDSEffectTypeSkinWiten = 18,
    STDSEffectTypeGlowColor = 19,
    STDSEffectTypeMosaic = 20,
    STDSEffectTypeStroke = 21,
    STDSEffectTypeFill = 22,
    STDSEffectTypeMaskKey = 23,
    STDSEffectTypePuzzleUnit = 24, // 拼图单元
    STDSEffectTypePuzzleStars = 25,
    STDSEffectTypeSolidColor = 26,
    STDSEffectTypePuzzleGlass = 27, // 拼图毛玻璃效果
    STDSEffectTypePuzzleCartoon = 28,
    STDSEffectTypeBilateralBlur = 29,
    STDSEffectTypeGlassTile = 30, // 玻璃拼贴效果
    STDSEffectTypePictrueDissip = 31, // 粒子消散效果
    STDSEffectTypeHairPainter = 32, // 染发
    STDSEffectTypeCloneStamp = 33, // 仿制图章
    STDSEffectTypeLut = 34, // 颜色查找表
} STDSEffectType;

/// 3D 位置
typedef struct {
    float x;
    float y;
    float z;
} STDSPoint3D;

/// 欧拉角
typedef struct {
    float Pitch; // 仰俯角
    float Yaw; // 偏航角
    float Roll; // 滚转角
} STDSEulerAngle;

@interface STDSGLParam : NSObject
@property (nonatomic, assign) int layerID; // 图层ID
@property (nonatomic, assign) int assetID; // 资源ID
@property (nonatomic, assign) CGFloat startLife; // 图层开始时间
@property (nonatomic, assign) CGFloat durationLife; // 图层持续时间
@property (nonatomic, assign) BOOL isVisible; // 图层是否可见
@property (nonatomic, assign) CGFloat alpha; // 图层透明度
@property (nonatomic, assign) STDSBlendType blendType; // 混合模式
@property (nonatomic, assign) STDSLayerType layerType; // 图层类型
@property (nonatomic, strong) NSMutableArray<NSNumber*>*effects;// 效果列表
@property (nonatomic, assign) CGSize size; // 大小，归一化
@property (nonatomic, assign) CGPoint center; // 中心，归一化
@property (nonatomic, assign) CGSize scale; // 缩放，归一化
@property (nonatomic, assign) CGFloat rotate; // 旋转，弧度
@property (nonatomic, assign) BOOL autoSize; // 自动大小

- (void)addEffect:(STDSEffectType)effect;

- (void)removeEffect:(STDSEffectType)effect;

- (void)popEffect;
@end

/// 图片图层
@interface STDSGLImageParam : STDSGLParam
@property (nonatomic, copy, nullable) NSString *path; // 图片路径
@property (nonatomic, assign, nullable) unsigned char *data; // 图片数据
@property (nonatomic, assign) int textureId; // 纹理 id
@property (nonatomic, assign) int width; // 图片宽
@property (nonatomic, assign) int height; // 图片高
@end

/// 文本图层
@interface STDSGLTextParam : STDSGLParam
@property (nonatomic, copy, nullable) NSString *path;
@end

/// 视频图层
@interface STDSGLVideoParam : STDSGLParam
@property (nonatomic, copy, nullable) NSString *path;
@end

/// 形状图层
@interface STDSGLShapenParam : STDSGLParam
@property (nonatomic, copy, nullable) NSString *path;
@end

/// 预合成层
@interface STDSGLCompseParam : STDSGLParam
@property (nonatomic, copy) NSString *path;
@end

/// 空图层
@interface STDSGLEmptyParam : STDSGLParam
@property (nonatomic, copy, nullable) NSString *path;
@end

/// 纯色层
@interface STDSGLSolidParam : STDSGLParam
@property (nonatomic, assign) float r;
@property (nonatomic, assign) float g;
@property (nonatomic, assign) float b;
@end

/// 摄像机层
@interface STDSGLCamoraParam : STDSGLParam
@property (nonatomic, assign) STDSPoint3D P1; // 摄像机的位置
@property (nonatomic, assign) STDSPoint3D p2; // 观测点的位置
@property (nonatomic, assign) bool lookat; // 是否忘观测点看
@property (nonatomic, assign) STDSEulerAngle angle; //
@end
NS_ASSUME_NONNULL_END
